package com.bank.controler;

import com.bank.biz.BankBiz;
import com.bank.entity.BankAccount;
import com.bank.entity.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpSession;

@RestController
@RequestMapping("user")
public class AccountControler {
    @Autowired
    BankBiz biz;
    @PostMapping("login")
    public Result login(BankAccount account, HttpSession session) {
       return biz.login(account,session);
    }
    @GetMapping("")
    public Result getAllOprecord() {
        return null;
    }
    @RequestMapping("logout")
    public ModelAndView logout(HttpSession session, ModelAndView mav){
        session.invalidate();
        mav.setViewName("redirect:/index.html");
        return mav;
    }
}
